package com.pctx.bibaregisterlogin.eccontroller;

import com.pctx.bibacommon.result.Result;
import com.pctx.bibaregisterlogin.pojo.Company;
import com.pctx.bibaregisterlogin.service.CompanyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created by chason on 2018/3/12.11:46
 */
@RestController
@RequestMapping("company")
@EnableEurekaClient
public class EcCompanyController {
    @Autowired
    private CompanyService companyService;

    @GetMapping("getByCompanyNo")
    public Result getByCompanNo(@RequestParam(value = "companyNo", required = true) String companyNo) throws Exception {
        Company company = companyService.getByCompanyNo(companyNo);
        if (null != company)
            return Result.success(company);
        else
            return Result.error("");
    }
}
